<template>
	<view class="content">
		<view class="content-block">
			<view class="title">{{detail.name}}</view>
			<view class="sub-title">发布时间：{{detail.createTime}}</view>
			<view class="article-content">
				<mp-html :content="detail.introduce" />
			</view>
		</view>
		<view class="apply-btn" v-if="type==3">在线申请</view>
		<view class="step" @click="enrollment">
			我要报名
		</view>
	</view>
</template>

<script>
	import {
		getUserEntrepreneursById,
		userAddEntrepreneursUser
	} from '@/api/bus.js';
	import {
		showToast
	} from '@/util/util.js'
	export default {
		data() {
			return {
				detail: {},
				latitude: '',
				longitude: '',
				id: null,
			}
		},
		methods: {
			getDetail(id) {
				getUserEntrepreneursById({
					id: this.id,
					latitude: this.latitude,
					longitude: this.longitude,
				}).then((res) => {
					this.detail = res
				})
			},
			enrollment() {
				userAddEntrepreneursUser({
					id: this.id,
				}).then((res) => {
					this.showToast('报名成功', () => {
						uni.navigateBack()
					}, 1000)
				})
			}
		},
		onLoad(e) {
			this.id = e.id;
			this.latitude = e.latitude;
			this.longitude = e.longitude;
			this.getDetail()
		},
	}
</script>

<style lang="scss">
	page {
		background: #EFEFEF;
	}

	img {
		max-width: 100%;
	}

	.content {
		width: 100%;
		height: 100vh;
		padding-bottom: 20rpx;

		.content-block {
			height: 100vh;
			background-color: #fff;
			padding: 30rpx;

			.title {
				font-size: 40rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
			}

			.sub-title {
				font-size: 28rpx;
				color: #999;
				margin-bottom: 30rpx;
			}
		}

		.step {
			width: 70%;
			height: 100rpx;
			display: flex;
			background: linear-gradient(90deg, #FF2F34 0%, #FF6B18 100%);
			color: #fff;
			margin: 30rpx auto;
			border-radius: 60rpx;
			justify-content: center;
			align-items: center;
			position: fixed;
			bottom: 30rpx;
			right: 118rpx;
		}


	}
</style>